<template>
  <div>
    <div>
      原始值： {{ obj.count }}
      <van-button type="primary" @click="add">修改</van-button>
    </div>
    <div>2倍原始值： {{ doubleB }}</div>

  </div>
</template>

<script>
import {
  reactive,
  computed
} from 'vue';
export default {
  name: "temp",
  setup() {
    let obj = reactive({
      count: 1
    });

    const add = () => { // 修改原始值
      obj.count++;
    }
  
    const doubleB = computed(() => {
      return 2 * obj.count;
    })
    return {
      obj,
      add,
      doubleB
    }
  }
}
</script>